package com.ms.service.module.fish.db;

import javax.persistence.Transient;

import com.ms.service.module.fish.game.FishUser;
import com.ms.service.module.fish.utils.GoConstant;
import com.xpec.c4.game.utility.GUID;

public class UsrGameLog {

	private FishUser user;
	
	public UsrGameLog(FishUser gameInfo) {
		if(gameInfo != null){
			this.setCoin(gameInfo.getCoin());
		}
		user = gameInfo;
	}

	public UsrGameLog() {
	}

	private int deskId; // 机台号
	private int roundNumber; // 第几局
	private Long coin; // 当前金币
	private Integer fireBull; // 发射炮弹
	private int lostCoin; // 消耗金币
	
	private Integer boomBull; // 爆炸炮弹
	private int addCoin = 0; // 赢得金币
	
	private Integer scriptId = 0; // 攻击鱼、捕获鱼
	private int rate = 0; // 倍率
	@Transient
	private int orate = -1; // 额外倍率
	@Transient
	private int yrate = -1; // 预计倍率
	
	/** 不存库数据 **/
	private int battary = -1; // 获得的炮台
	
	public GUID getUid() {
		return user== null?null:user.getUid();
	}

	public Long getCoin() {
		return coin;
	}

	public void setCoin(Long coin) {
		this.coin = coin;
	}

	public Integer getAddCoin() {
		return addCoin;
	}

	public void setAddCoin(Integer addCoin) {
		this.addCoin = addCoin;
	}

	public Integer getLostCoin() {
		return lostCoin;
	}

	public void setLostCoin(Integer lostCoin) {
		this.lostCoin = lostCoin;
	}

	public Integer getRate() {
		return rate;
	}

	public void setRate(Integer rate) {
		this.rate = rate;
	}

	public Integer getScriptId() {
		return scriptId;
	}

	public void setScriptId(Integer scriptId) {
		this.scriptId = scriptId;
	}

	public int battary(){
		return battary;
	}
	public void battary(int battary){
		this.battary = battary;
	}
	
	public FishPlayerLogModel toLogModel() {
		FishPlayerLogModel logModel = new FishPlayerLogModel();
		logModel.setBet(this.lostCoin);
		logModel.setGain(this.addCoin-this.lostCoin);
		logModel.setGameName(GoConstant.GAME_NAME);
		logModel.setGameTime(System.currentTimeMillis());
		logModel.setGoldCoin(this.coin);
		logModel.setMachineNumber(deskId);
		logModel.setPlayerGUID(user==null?"":this.getUid().toString());
		logModel.setPlayerName(user==null?"":user.getName());
		logModel.setScore(this.addCoin);
		logModel.setRoundNumber(String.valueOf(roundNumber));
		
		logModel.setBoomBull(boomBull);
		logModel.setRate(rate);
		logModel.setFireBull(fireBull);
		logModel.setScriptId(scriptId);
		
		return logModel;
	}

	public Integer getFireBull() {
		return fireBull;
	}

	public void setFireBull(Integer fireBull) {
		this.fireBull = fireBull;
	}

	public Integer getBoomBull() {
		return boomBull;
	}

	public void setBoomBull(Integer boomBull) {
		this.boomBull = boomBull;
	}
	
	public int orate() {
		return orate;
	}
	public void orate(int orate) {
		this.orate = orate;
	}

	public int yrate() {
		return yrate;
	}

	public void yrate(int yrate) {
		this.yrate = yrate;
	}
}
